// ex6_4.cpp
#include <iostream>
#include <string>
const int strsize = 20;
struct bop
{
    char fullname[strsize];    // real name
    char title[strsize];       // job title
    char bopname[strsize];     // secret BOP name
    int  preference;           // 0 = fullname, 1 = title, 2 = bopname
};

//void input_data(struct *bop);
//void display(struct);
void menu();
int main(void)
{
    using namespace std;
    bop bops[5] = 
    {
        {"Wimp Macho", "Wimp title", "Wimp bopname", 0},
        {"Raki Rhodes", "Junior Programmer", "Raki bopname", 1},
        {"Celia Laiter", "Celia title", "MIPS", 2},
        {"Hoppy Hipman", "Analyst Trainee", "Hoppy bopname", 1},
        {"Pat Hand", "Pat title", "LOOPY", 2}
    };
    menu();
    char ch;
    cout << "Enter you choice: ";
    cin.get(ch).get();
    while (ch != 'q')
    {
        switch (ch) 
        {
            case 'a':
                for (int i = 0; i < 5; i++)
                {
                    cout << bops[i].fullname << endl;
                }
                break;
            case 'b':
                for (int i = 0; i < 5; i++)
                {
                    cout << bops[i].title << endl;
                }
                break;
            case 'c':
                for (int i = 0; i < 5; i++)
                {
                    cout << bops[i].bopname << endl;
                }
                break;
            case 'd':
                for (int i = 0; i < 5; i++)
                {
                    switch(bops[i].preference)
                    {
                        case 0:
                            cout << bops[i].fullname << endl;
                            break;
                        case 1:
                            cout << bops[i].title << endl;   
                            break;
                        case 2:
                            cout << bops[i].bopname << endl;      
                            break;
                    }
                }
                break;
            case 'q':
                break;
        }
        menu();
        cout << "Next choice: ";
        cin.get(ch).get();
    }
}

// void input_data(struct *bp)
// {
//     cout << "Enter your fullname: ";
//     cin.getline(bp->fullname, strsize);
//     cout << "Enter your job title: ";
//     cin.getline(bp->title, strsize);
//     cout << "Enter your preference: ";
//     cin >> bp->preference;
//     cin.get();
//}

void menu()
{
    std::cout << "Benevolent Order of Programmers Report\n";
    std::cout << "a. display by name        b. display by title\n";
    std::cout << "c. display by bopname     d. display by preference\n";
    std::cout << "q. quit\n";
}

//void display(struct bop)


